#!/bin/sh
if [ $# != 3 ]; then
echo "参数不对."
echo "USAGE: $0 TYPE(0.backup 1.import) TABLE FILENAME"
exit 1;
fi

if [ $1 == 1 ] ; then
    echo "start backup $2>$3."
     /usr/local/mysql/bin/mysqldump --host=127.0.0.1 --port=3306  -uroot $2>$3
    echo "finish backup."
elif [ $1 == 2 ] ; then
    echo "start import $2<$3."
    /usr/local/mysql/bin/mysql --host=127.0.0.1 --port=3306  -uroot  $2<$3
    echo "finish import."
fi